import datetime
import time

def getDateTime():
    '''编写一个日常用到的python时间相关方法'''
    datetime.date.today()
    print(datetime.timedelta(2))
    # cmd = "cd {dir}; ./{sh} 1 {st} {et}".format(dir=dirname, sh=filename, st=stimestamp, et=etimestamp)
    # print(("Execute Command failed: %s" % cmd))

    p_timestamp = int(time.time())

    p_timestamp_hour = round((p_timestamp - 3600 * 2) / 3600) * 3600

    p_hour = time.strftime("%Y%m%d_%H", time.localtime(p_timestamp_hour))


    print(p_timestamp,p_timestamp_hour,p_hour)
    return datetime.datetime.today()

if __name__ == '__main__':
   getDateTime()

